package org.jeecg.modules.third.jg.report.information.thrift;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TJSONProtocol;
import org.apache.thrift.protocol.TMultiplexedProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.junit.After;
import org.junit.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 *
 *
 * @author duanlikao
 * @created 2020/12/31
 */
@Service
public class ReportPlatformServiceClient {

//    private static final Logger LOGGER = LoggerFactory.getLogger(ReportPlatformServiceClient.class);
//
//    @Value(value="${reportclient.ip}")
//    public String host;
//    @Value(value="${reportclient.port}")
//    private int port;
//    public String getHost() {
//        return host;
//    }
//    public void setHost(String host) {
//        this.host = host;
//    }
//    public int getPort() {
//        return port;
//    }
//    public void setPort(int port) {
//        this.port = port;
//    }
//
//    ReportService.Client rClient;
//    /**
//     * 非阻塞TTransport
//     */
//    TTransport transport;
//
//    @Before
//    public void init() {
//        transport = new TSocket(host, port);
//        //Json协议
//        TJSONProtocol protocol = new TJSONProtocol(transport);
//        TMultiplexedProtocol rProtocol = new TMultiplexedProtocol(protocol,"reportServiceProcessor");
//        rClient = new ReportService.Client(rProtocol);
//    }
//
//    public ReportService.Client getReportService() {
//        return rClient;
//    }
//
//    public  void  open() {
//        try {
//            transport.open();
//        } catch (TTransportException e) {
//            LOGGER.info("ReportPlatformClient init open TTransportException : {}" ,e.getMessage());
//        }
//    }
//    /**
//     * 天津省平台上报信息
//     * @param reporDocType
//     * @param xmlString
//     * @return
//     */
//    public boolean reportPlatform(String reporDocType ,String xmlString) {
//        try {
//            open();
//            return rClient.reportPlatform(reporDocType , xmlString);
//        } catch (TException e) {
//            LOGGER.info("ReportPlatformServiceClient reportPlatform : {}" ,e.getMessage());
//        }
//        return false;
//    }
//    @After
//    public void close() {
//        transport.close();
//    }

}
